package com.cxyxj.validateddemo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.Date;
import java.util.List;

/**
 * @author: gongj
 * @create: 2022-01-28 14:46
 */
@Data
public class UserReq {

    @NotBlank(message = "name为必传参数")
    private String name;

    @Email(message = "email格式错误，请重新填写")
    @NotBlank(message = "email为必传参数")
    private String email;

    @NotNull(message = "proReq对象不能为空")
    @Valid
    private ProReq proReq;

    //@Pattern(regexp = "^1[3456789]\\d{9}$",message = "手机号格式不正确")
    @Phone
    @NotBlank(message = "手机号码为必传参数")
    private String tel;


   // @AssertFalse(message = "该参数必须为 false")
    private Boolean enableFalse;

   // @AssertTrue(message = "该参数必须为 true")
    private Boolean enableTrue;

  //  @DecimalMax(value = "100",message = "该参数不能大于 100")
    private Integer ageMax;

  //  @DecimalMax(value = "0",message = "该参数不能小于 0")
    private Integer ageMin;

  //  @Digits(integer = 3,fraction = 2,message = "该参数整数位数不能超出3位，小数位数不能超过2位")
    private String ageDigits;


    //@Future(message = "预约时间要大于当前时间")
    @JsonFormat(pattern ="yyyy-MM-dd hh:mm:ss")
    private Date reservationTime;

    //@FutureOrPresent(message = "预约时间2要大于当前时间")
    @JsonFormat(pattern ="yyyy-MM-dd hh:mm:ss")
    private Date reservationTime2;

    //@Max(value = 200,message = "最大金额不能超过 200")
    private Integer maxAmount;

    //@Min(value = 0,message = "最小金额不能小于 0")
    private Integer minAmount;

   // @Negative(message = "必须是负数")
    private Integer negative;

    //@NegativeOrZero(message = "必须是负数或者为0")
    private Integer negativeOrZero;

    //@NotEmpty(message = "不能为null或者为空")
    private List<String> lists;

    //@NotNull(message = "不能为null")
    private Integer xx;

    //@Null(message = "必须为null")
    private Integer xxx;

   // @Past(message = "出生时间要小于当前时间")
    @JsonFormat(pattern ="yyyy-MM-dd hh:mm:ss")
    private Date bornTime;

    //@PastOrPresent(message = "出生时间要小于当前时间")
   @JsonFormat(pattern ="yyyy-MM-dd hh:mm:ss")
    private Date bornTime2;

   // @Positive(message = "必须是正数")
    private Integer positive;

   // @PositiveOrZero(message = "必须是正数或者为0")
    private Integer positiveOrZero;

    //@Size(min = 5,max = 20,message = "字符长度在 5 -20 之间")
    private String strSize;



}
